<!DOCTYPE html>
<html>
    {{ partial "head.html" . }}
    <link href="{{ .Site.BaseURL }}css/docs.css" rel="stylesheet">
    <header id="header">
        {{ partial "nav-blue.html" . }}
    </header>
    <body baseUrl="{{ .Site.BaseURL }}">
        <div id="content" class="docs">
            <!-- docs-nav -->
            <div class="content-menu docs-menu">
            {{- $currentNode := . }}
            {{- range  where .Site.Home.Sections.ByWeight "Type" "docs"}}
            {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
            {{- end }}

            <!-- templates -->
            {{- define "section-tree-nav" }}

            {{- $currentNode := .currentnode }}
            {{- with .sect}}
            {{- if and .IsSection}}
                {{- $numberOfPages := (add (len .Pages) (len .Sections)) }}
                {{- safeHTML .Params.head}}
                
                <li data-nav-id="{{.URL}}" class="dd-item
                    {{- if .IsAncestor $currentNode}} parent{{end}}
                    {{- if eq .URL $currentNode.URL}} active{{end}}
                    {{- if .Params.alwaysopen}} alwaysopen{{end -}}
                    {{- if ne $numberOfPages 0 }} haschildren{{end}}">
                {{if eq .Name "文档"}}
                    {{else}}
                    <div class="dir-div">
                    {{- if ne $numberOfPages 0 }}
                        <a class="category" href="{{ .RelPermalink}}">{{safeHTML  .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}</a>
                        {{else}}
                        <a href="{{ .RelPermalink}}">{{safeHTML  .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}</a>
                    {{end}}
                    {{- if ne $numberOfPages 0 }}
                        {{- if or (.IsAncestor $currentNode) (.Params.alwaysopen) }}
                        <i class="iconfont caret-down category-icon">&#xe639;</i>
                        {{- else -}}
                        <i class="iconfont caret-right category-icon">&#xe66f;</i>
                        {{- end}}
                    {{- end}}
                    </div>
                {{end}}
                {{- if ne $numberOfPages 0 }}
                    <ul class="none">
                    {{- .Scratch.Set "pages" .Pages }}
                    {{- if .Sections}}
                    {{- .Scratch.Set "pages" (.Pages | union .Sections) }}
                    {{- end}}
                    {{- $pages := (.Scratch.Get "pages") }}

                    {{- range $pages.ByWeight }}
                        {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode}}
                    {{- end}}
                    </ul>
                {{- end}}
                </li>
            {{- else}}
                <li data-nav-id="{{.URL}}" class="dd-item
                {{- if eq .URL $currentNode.URL}} active{{end -}}
                ">
                    <div>
                    <a href="{{ .RelPermalink}}">
                        {{safeHTML .Params.Pre}}{{.LinkTitle}}{{safeHTML .Params.Post}}
                    </a>
                    </div>
                </li>
            {{- end}}
            {{- end}}
            {{- end}}
            </div>
            <!-- docs-nav end -->
            <div class="docs-post content-post" id="content-post">
                {{ .Content }}
            </div>
            <div class="content-menu article-menu">
                {{ partial "widgets/search.html" . }}
                <!--详情页右侧标题导航栏-->
                <ul id="article-nav-ul">
                </ul>
            </div>
        </div>
        <!-- /#content -->
        <div style="clear: both;"></div>
        {{ partial "footer.html" . }}
        {{ partial "scripts.html" . }}
        <!-- highlight.js -->
        <link rel="stylesheet" href="{{ .Site.BaseURL }}highlight/styles/atom-one-light.css">
        <script src="{{ .Site.BaseURL }}highlight/highlight.min.js"></script>
        <script>hljs.initHighlightingOnLoad();</script>
    </body>
<!-- doc search -->
<script src="{{ .Site.BaseURL }}js/doc-search.js"></script>
<!-- doc search end -->
</html>
